package com.lmk.t03;

import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;

public class DateTest {
    public static void main(String[] args) {
        //获取当前时间
        Date birthday=new Date();
        System.out.println(birthday);
        //创建指定时间的日期
        Calendar c=Calendar.getInstance();
        c.set(Calendar.YEAR,2001);
        c.set(Calendar.MONTH,4);//月份从零开始计数
        c.set(Calendar.DAY_OF_MONTH,23);
        c.set(Calendar.HOUR_OF_DAY,11);
        c.set(Calendar.MINUTE,2);
        c.set(Calendar.SECOND,20);

        Date bir=c.getTime();
        System.out.println(bir);
        //日期格式化输出
        String  temp="yyyy-mm-dd HH:mm:ss E";
        SimpleDateFormat sdf=new SimpleDateFormat(temp);
       String S= sdf.format(bir);
        System.out.println(S);


    }
}
